<template>
  <div>
    <VanButton @click="curComName = curComName === 'Hello' ? 'World' : 'Hello'">Toggle</VanButton>

    <Transition name="fade" mode="out-in">
      <component :is="curComName === 'Hello' ? Hello : World"></component>
    </Transition>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import Hello from './components/Hello.vue'
import World from './components/World.vue'

const curComName = ref('Hello')
</script>

<style lang="scss" scoped>
.fade-enter-from {
  transform: translateY(30px);
}

.fade-leave-to {
  transform: translateY(-30px);
}

.fade-leave-active {
  transition: transform 0.5s ease;
}

.fade-enter-active {
  transition: transform 0.5s ease;
}
</style>
